﻿using System;
using System.Web.UI.WebControls;

namespace Medianamik.Core
{
    public class MedianamikControl
    {
        internal MedianamikControl(Guid id, string fullName, DataType dataType)
        {
            ID = id;
            FullName = fullName;
            DataType = dataType;
        }

        public Guid ID
        {
            get;
            internal set;
        }

        public string Name
        {
            get;
            internal set;
        }

        public string FullName
        {
            get;
            internal set;
        }

        public DataType DataType { get; private set; }

        public bool MaySpecifyWidth
        {
            get;
            internal set;
        }

        public bool MaySpecifyHeight
        {
            get;
            internal set;
        }

        public Unit? DefaultWidth
        {
            get;
            internal set;
        }

        public short? DefaultHeight
        {
            get;
            internal set;
        }

        public bool MaySpecifyValidationExpression
        {
            get;
            internal set;
        }

        public bool MaySpecifyLength
        {
            get;
            internal set;
        }

        public short? DefaultMaxLength
        {
            get;
            internal set;
        }

        public bool MayBeRequired
        {
            get;
            internal set;
        }

        public bool MayBeUnique
        {
            get;
            internal set;
        }

        internal IMedianamikControl CreateInstance()
        {
            var b = new ObjectBuilder(FullName);

            return b.GetInstance<IMedianamikControl>();
        }
    }
}